package com.hy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hy.medicine.evaluation.pojo.MedicineEvaluationLike;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 评价点赞
 */
@Mapper
public interface MedicineEvaluationLikeMapper extends BaseMapper<MedicineEvaluationLike> {

    /**
     * 检查用户是否点赞
     * @param evaluationId
     * @param userId
     * @return
     */
    @Select("SELECT COUNT(*) FROM medicine_evaluation_like WHERE evaluation_id = #{evaluationId} AND user_id = #{userId}")
    int checkUserLiked(@Param("evaluationId") Integer evaluationId, @Param("userId") Integer userId);
}
